<!DOCTYPE html>
<html lang="zh-cn">

<head>
<meta charset="utf-8" />
<meta name="author" content="TianShangXing" />
<meta name="description" content="Personal blog." />
<meta name="keywords" content="blog, tech" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="generator" content="Hugo 0.68.3" />

<link rel="canonical" href="https://tianshangxing.gitee.io/myblog/blog/git%E5%91%BD%E4%BB%A4%E6%80%BB%E7%BB%93/">
<meta property="og:title" content="Git命令总结" />
<meta property="og:description" content="Git命令操作 0.1.git init # 初始化 0.2.git remote add origin url地址 # 关联远程仓库 1.git status # 查看状态 2.git add -A # 添加文件 3.git commit -m &#39;备注信息&#39; # 提交修改 4.git push -u origin master # 推送此次修改 # git 3连 1.git add -A # 添加新文件 2.git commit -m &#39;备注信息&#39; # 提交修改 3.git push # 推送此次修改 清空密码 git config --system --unset credential.helper 保存密码 git config --global credential.helper store 拉取代码 git pull origin master 没有add 回退 git checkout ." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://tianshangxing.gitee.io/myblog/blog/git%E5%91%BD%E4%BB%A4%E6%80%BB%E7%BB%93/" />
<meta property="article:published_time" content="2020-02-15T10:10:51+08:00" />
<meta property="article:modified_time" content="2020-02-15T10:10:51+08:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Git命令总结"/>
<meta name="twitter:description" content="Git命令操作 0.1.git init # 初始化 0.2.git remote add origin url地址 # 关联远程仓库 1.git status # 查看状态 2.git add -A # 添加文件 3.git commit -m &#39;备注信息&#39; # 提交修改 4.git push -u origin master # 推送此次修改 # git 3连 1.git add -A # 添加新文件 2.git commit -m &#39;备注信息&#39; # 提交修改 3.git push # 推送此次修改 清空密码 git config --system --unset credential.helper 保存密码 git config --global credential.helper store 拉取代码 git pull origin master 没有add 回退 git checkout ."/>


<meta itemprop="name" content="Git命令总结">
<meta itemprop="description" content="Git命令操作 0.1.git init # 初始化 0.2.git remote add origin url地址 # 关联远程仓库 1.git status # 查看状态 2.git add -A # 添加文件 3.git commit -m &#39;备注信息&#39; # 提交修改 4.git push -u origin master # 推送此次修改 # git 3连 1.git add -A # 添加新文件 2.git commit -m &#39;备注信息&#39; # 提交修改 3.git push # 推送此次修改 清空密码 git config --system --unset credential.helper 保存密码 git config --global credential.helper store 拉取代码 git pull origin master 没有add 回退 git checkout .">
<meta itemprop="datePublished" content="2020-02-15T10:10:51&#43;08:00" />
<meta itemprop="dateModified" content="2020-02-15T10:10:51&#43;08:00" />
<meta itemprop="wordCount" content="96">



<meta itemprop="keywords" content="" />

<link rel="stylesheet" href="https://tianshangxing.gitee.io/myblog/css/layout.css" />


<link rel="stylesheet" href="https://tianshangxing.gitee.io/myblog/css/default-dark.css" />




<title>


     Git命令总结 

</title>

</head>


<body>
<div class="main">
<header>

<div class="header-bar">

  <nav>
    <div class="siteTitle">
      <a href="https://tianshangxing.gitee.io/myblog">TianShangXing&#39;s Blog</a>
    </div> 

    
    
    <a class="nav-item" href="https://tianshangxing.gitee.io/myblog/blog/"><div class="nav-item-title">Blogs</div></a>
    
    <a class="nav-item" href="https://tianshangxing.gitee.io/myblog/resume/"><div class="nav-item-title">Resume</div></a>
    

  </nav>

  
<div class="social-links-header">

  
  <a href="mailto:tian_shang_xing@foxmail.com"><div class="social-link">email</div></a>
  

  
  <a href="https://github.com/TianShangXing" target="_blank"><div class="social-link">gh</div></a>
  

  

  

  
  <a href="https://www.linkedin.com/in/%e6%98%9f%e4%bc%b8-%e5%88%98-b7b7321a6" target="_blank"><div class="social-link">in</div></a>
  

</div>


</div>


</header>


<article class="post">
    <h1 class="title"> Git命令总结 </h1>
    <div class="content"> <h3 id="git命令操作">Git命令操作</h3>
<pre><code>0.1.git init # 初始化
0.2.git remote add origin url地址 # 关联远程仓库
1.git status # 查看状态
2.git add -A # 添加文件
3.git commit -m '备注信息' # 提交修改
4.git push -u origin master # 推送此次修改

# git 3连
1.git add -A # 添加新文件
2.git commit -m '备注信息' # 提交修改
3.git push # 推送此次修改

清空密码
git config --system --unset credential.helper

保存密码
git config --global credential.helper store

拉取代码
git pull origin master

没有add 回退
git checkout .

已经add提交到本地暂存区 重置
git reset HEAD
git checkout .

查看日志
git log

回退到某一次
git reset --hard 日志号

强推
git push origin HEAD --force
</code></pre> </div>
    <footer class="post-footer">

  <div class="post-footer-data">
            
<div class="tags">
  
</div>

    <div class="date"> 2020-02-15 </div>
    
  </div>
</footer>



</article>

  <footer>

  <div class="social-links-footer">

  
  <a href="mailto:tian_shang_xing@foxmail.com"><div class="social-link">Email</div></a>
  

  
  <a href="https://github.com/TianShangXing" target="_blank"><div class="social-link">GitHub</div></a>
  

  

  

  
  <a href="https://www.linkedin.com/in/%e6%98%9f%e4%bc%b8-%e5%88%98-b7b7321a6" target="_blank"><div class="social-link">LinkedIn</div></a>
  

  <div class="social-link">
  <a href="https://tianshangxing.gitee.io/myblog/index.xml" target="_blank">RSS</a>
  </div>

</div>


  <div class="copyright"> Copyright (c) 2020, all rights reserved. </div>

  <div class="poweredby">
    Powered by <a href="https://gohugo.io/">Hugo</a>.
  </div>

  </footer>

</div> 

</body>
</html>

